﻿    <?php
        if(isset($_SESSION["MaTaiKhoan"]) && isset($_REQUEST['id']))
        {
            $MaND = $_SESSION["MaTaiKhoan"];
            $MaSP = $_REQUEST["id"];
            include_once("template/DataProvider.php");
            $query = " SELECT * FROM sanpham WHERE MaND = '".$MaND."' AND MaSP = '".$MaSP."'";
            $result=DataProvider::executeQuery($query);
            $row = mysql_fetch_array($result);
            
            $query1 = "SELECT TenHSX FROM hangsx WHERE MaHSX = '".$row['MaHSX']."' ";
            $result1=DataProvider::executeQuery($query1);
            $row1 = mysql_fetch_array($result1);
            
            $query2 = " SELECT TenLSP FROM loaisp WHERE MaLSP = '".$row['MaLSP']."' ";
            $result2=DataProvider::executeQuery($query2);
            $row2 = mysql_fetch_array($result2);
        }
    ?>
    <style type="text/css">
        .dangsp
        {
                width: 550px;
                height: 40px;
                color: #0073ff;
        }
        .dangsp1
        {
            width: 300px;
            text-align: left;
        }       
    </style>
    <fieldset id = "field"style="background-color: #d6d6d6; border-radius: 5px; border-bottom-color: #9c9c9c; border-left-style: inset; box-shadow: 3px 3px 1px #888888">
    <legend style="color: #de2828 ; text-shadow:2px 2px 5px#383838;"><h1>Cập nhật sản phẩm</h1></legend>
    <hr width="300" />
    <form enctype="multipart/form-data" action="trangchu.php?act=12&id=<?php echo $MaSP; ?>" method="post" onsubmit="return KiemTraDangSP()">
        <table border="0" cellpadding="0" cellspacing="0" style="border-color: #0080FF; text-align: right;" >
            <tr>
                <td  class="dangsp">Tên sản phẩm &nbsp; </td>
                <td class="dangsp1"><input type="text" id="tensp" name="tensp" value="<?php echo $row['TenSP']; ?>" style="width: 250px; padding: 3px 3px; border: none; border-bottom:1px dotted #1e2e59; background: #d6d6d6; " /></td>
            </tr>
            <tr>
                <td class="dangsp">    
                    Hình sản phẩm &nbsp;
                </td>
                <td class="dangsp1">
                    	<table width="350" border="0" cellpadding="1" cellspacing="1">
                        	<tr>
                            	<td width="246">
                                	<input class="button" type="hidden" name="MAX_FILE_SIZE" value="1000000" />
                                    <input class="button" name="userfile" type="file" id="userfile" style="width: 250px; padding: 3px 3px; border: none; border-bottom:1px dotted #1e2e59; background: #d6d6d6; " />
                                </td>
                            </tr>
                        </table>
                </td>
            </tr>
            <tr>
                <td  class="dangsp">Giá&nbsp; </td>
                <td class="dangsp1"><input type="text" id="giasp" name="giasp" value="<?php echo number_format($row['GiaSP']) ?>" style="width: 250px; padding: 3px 3px; border: none; border-bottom:1px dotted #1e2e59; background: #d6d6d6; "  />&nbsp; <font color="red">( VNĐ )</font></td>
            </tr>
            <tr>
                <td  class="dangsp">Số lượng sản phẩm&nbsp; </td>
                <td class="dangsp1"><input type="text" id="soluong" name="soluong" value="<?php echo $row['SoLuongTon'] ?>" style="width: 250px; padding: 3px 3px; border: none; border-bottom:1px dotted #1e2e59; background: #d6d6d6; "/></td>
            </tr>
            <tr>
                <td  class="dangsp">Mô tả về sản phẩm&nbsp; </td>
                <td class="dangsp1">
                    <textarea id="mota" name="mota" style="width: 350px; padding: 3px 3px; border: 1px dotted; background: #d6d6d6; height: 250px; "><?php echo $row['MoTaSP'];  ?></textarea>
                </td>
            </tr>
        
        </table>
            <div style="text-align: center;"><input type="submit" value="Cập nhật lại" style="background-color:#007bff ; border-radius: 5px; color: white;" /></div>

    </form>
</fieldset>
